<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>LCOV - code analysis - src/caffe/layers/spp_layer.cpp</title>
  <link rel="stylesheet" type="text/css" href="../../../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LCOV - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../../../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
          <tr>
            <td width="10%" class="headerItem">Current view:</td>
            <td width="35%" class="headerValue"><a href="../../../index.html">top level</a> - <a href="index.html">src/caffe/layers</a> - spp_layer.cpp<span style="font-size: 80%;"> (source / <a href="spp_layer.cpp.func-sort-c.html">functions</a>)</span></td>
            <td width="5%"></td>
            <td width="15%"></td>
            <td width="10%" class="headerCovTableHead">Hit</td>
            <td width="10%" class="headerCovTableHead">Total</td>
            <td width="15%" class="headerCovTableHead">Coverage</td>
          </tr>
          <tr>
            <td class="headerItem">Test:</td>
            <td class="headerValue">code analysis</td>
            <td></td>
            <td class="headerItem">Lines:</td>
            <td class="headerCovTableEntry">2</td>
            <td class="headerCovTableEntry">112</td>
            <td class="headerCovTableEntryLo">1.8 %</td>
          </tr>
          <tr>
            <td class="headerItem">Date:</td>
            <td class="headerValue">2020-09-11 22:25:26</td>
            <td></td>
            <td class="headerItem">Functions:</td>
            <td class="headerCovTableEntry">2</td>
            <td class="headerCovTableEntry">14</td>
            <td class="headerCovTableEntryLo">14.3 %</td>
          </tr>
          <tr>
            <td class="headerItem">Legend:</td>
            <td class="headerValueLeg">            Lines:
            <span class="coverLegendCov">hit</span>
            <span class="coverLegendNoCov">not hit</span>
</td>
            <td></td>
          </tr>
          <tr><td><img src="../../../glass.png" width=3 height=3 alt=""></td></tr>
        </table>
      </td>
    </tr>

    <tr><td class="ruler"><img src="../../../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td>
<pre class="sourceHeading">          Line data    Source code</pre>
<pre class="source">
<a name="1"><span class="lineNum">       1 </span>            : #include &lt;algorithm&gt;</a>
<span class="lineNum">       2 </span>            : #include &lt;vector&gt;
<span class="lineNum">       3 </span>            : 
<span class="lineNum">       4 </span>            : #include &quot;caffe/layer.hpp&quot;
<span class="lineNum">       5 </span>            : #include &quot;caffe/layers/concat_layer.hpp&quot;
<span class="lineNum">       6 </span>            : #include &quot;caffe/layers/flatten_layer.hpp&quot;
<span class="lineNum">       7 </span>            : #include &quot;caffe/layers/pooling_layer.hpp&quot;
<span class="lineNum">       8 </span>            : #include &quot;caffe/layers/split_layer.hpp&quot;
<span class="lineNum">       9 </span>            : #include &quot;caffe/layers/spp_layer.hpp&quot;
<span class="lineNum">      10 </span>            : 
<span class="lineNum">      11 </span>            : namespace caffe {
<span class="lineNum">      12 </span>            : 
<span class="lineNum">      13 </span>            : using std::min;
<span class="lineNum">      14 </span>            : using std::max;
<a name="15"><span class="lineNum">      15 </span>            : </a>
<span class="lineNum">      16 </span>            : template &lt;typename Dtype&gt;
<span class="lineNum">      17 </span><span class="lineNoCov">          0 : LayerParameter SPPLayer&lt;Dtype&gt;::GetPoolingParam(const int pyramid_level,</span>
<span class="lineNum">      18 </span>            :       const int bottom_h, const int bottom_w, const SPPParameter spp_param) {
<span class="lineNum">      19 </span><span class="lineNoCov">          0 :   LayerParameter pooling_param;</span>
<span class="lineNum">      20 </span><span class="lineNoCov">          0 :   int num_bins = pow(2, pyramid_level);</span>
<span class="lineNum">      21 </span>            : 
<span class="lineNum">      22 </span>            :   // find padding and kernel size so that the pooling is
<span class="lineNum">      23 </span>            :   // performed across the entire image
<span class="lineNum">      24 </span><span class="lineNoCov">          0 :   int kernel_h = ceil(bottom_h / static_cast&lt;double&gt;(num_bins));</span>
<span class="lineNum">      25 </span>            :   // remainder_h is the min number of pixels that need to be padded before
<span class="lineNum">      26 </span>            :   // entire image height is pooled over with the chosen kernel dimension
<span class="lineNum">      27 </span><span class="lineNoCov">          0 :   int remainder_h = kernel_h * num_bins - bottom_h;</span>
<span class="lineNum">      28 </span>            :   // pooling layer pads (2 * pad_h) pixels on the top and bottom of the
<span class="lineNum">      29 </span>            :   // image.
<span class="lineNum">      30 </span><span class="lineNoCov">          0 :   int pad_h = (remainder_h + 1) / 2;</span>
<span class="lineNum">      31 </span>            : 
<span class="lineNum">      32 </span>            :   // similar logic for width
<span class="lineNum">      33 </span><span class="lineNoCov">          0 :   int kernel_w = ceil(bottom_w / static_cast&lt;double&gt;(num_bins));</span>
<span class="lineNum">      34 </span><span class="lineNoCov">          0 :   int remainder_w = kernel_w * num_bins - bottom_w;</span>
<span class="lineNum">      35 </span><span class="lineNoCov">          0 :   int pad_w = (remainder_w + 1) / 2;</span>
<span class="lineNum">      36 </span>            : 
<span class="lineNum">      37 </span><span class="lineNoCov">          0 :   pooling_param.mutable_pooling_param()-&gt;set_pad_h(pad_h);</span>
<span class="lineNum">      38 </span><span class="lineNoCov">          0 :   pooling_param.mutable_pooling_param()-&gt;set_pad_w(pad_w);</span>
<span class="lineNum">      39 </span><span class="lineNoCov">          0 :   pooling_param.mutable_pooling_param()-&gt;set_kernel_h(kernel_h);</span>
<span class="lineNum">      40 </span><span class="lineNoCov">          0 :   pooling_param.mutable_pooling_param()-&gt;set_kernel_w(kernel_w);</span>
<span class="lineNum">      41 </span><span class="lineNoCov">          0 :   pooling_param.mutable_pooling_param()-&gt;set_stride_h(kernel_h);</span>
<span class="lineNum">      42 </span><span class="lineNoCov">          0 :   pooling_param.mutable_pooling_param()-&gt;set_stride_w(kernel_w);</span>
<span class="lineNum">      43 </span>            : 
<span class="lineNum">      44 </span><span class="lineNoCov">          0 :   switch (spp_param.pool()) {</span>
<span class="lineNum">      45 </span>            :   case SPPParameter_PoolMethod_MAX:
<span class="lineNum">      46 </span><span class="lineNoCov">          0 :     pooling_param.mutable_pooling_param()-&gt;set_pool(</span>
<span class="lineNum">      47 </span>            :         PoolingParameter_PoolMethod_MAX);
<span class="lineNum">      48 </span>            :     break;
<span class="lineNum">      49 </span>            :   case SPPParameter_PoolMethod_AVE:
<span class="lineNum">      50 </span><span class="lineNoCov">          0 :     pooling_param.mutable_pooling_param()-&gt;set_pool(</span>
<span class="lineNum">      51 </span>            :         PoolingParameter_PoolMethod_AVE);
<span class="lineNum">      52 </span>            :     break;
<span class="lineNum">      53 </span>            :   case SPPParameter_PoolMethod_STOCHASTIC:
<span class="lineNum">      54 </span><span class="lineNoCov">          0 :     pooling_param.mutable_pooling_param()-&gt;set_pool(</span>
<span class="lineNum">      55 </span>            :         PoolingParameter_PoolMethod_STOCHASTIC);
<span class="lineNum">      56 </span>            :     break;
<span class="lineNum">      57 </span>            :   default:
<span class="lineNum">      58 </span><span class="lineNoCov">          0 :     LOG(FATAL) &lt;&lt; &quot;Unknown pooling method.&quot;;</span>
<span class="lineNum">      59 </span>            :   }
<span class="lineNum">      60 </span>            : 
<span class="lineNum">      61 </span><span class="lineNoCov">          0 :   return pooling_param;</span>
<span class="lineNum">      62 </span>            : }
<span class="lineNum">      63 </span>            : 
<span class="lineNum">      64 </span>            : template &lt;typename Dtype&gt;
<span class="lineNum">      65 </span><span class="lineNoCov">          0 : void SPPLayer&lt;Dtype&gt;::LayerSetUp(const vector&lt;Blob&lt;Dtype&gt;*&gt;&amp; bottom,</span>
<span class="lineNum">      66 </span>            :       const vector&lt;Blob&lt;Dtype&gt;*&gt;&amp; top) {
<span class="lineNum">      67 </span><span class="lineNoCov">          0 :   SPPParameter spp_param = this-&gt;layer_param_.spp_param();</span>
<span class="lineNum">      68 </span>            : 
<span class="lineNum">      69 </span><span class="lineNoCov">          0 :   num_ = bottom[0]-&gt;num();</span>
<span class="lineNum">      70 </span><span class="lineNoCov">          0 :   channels_ = bottom[0]-&gt;channels();</span>
<span class="lineNum">      71 </span><span class="lineNoCov">          0 :   bottom_h_ = bottom[0]-&gt;height();</span>
<span class="lineNum">      72 </span><span class="lineNoCov">          0 :   bottom_w_ = bottom[0]-&gt;width();</span>
<span class="lineNum">      73 </span><span class="lineNoCov">          0 :   reshaped_first_time_ = false;</span>
<span class="lineNum">      74 </span><span class="lineNoCov">          0 :   CHECK_GT(bottom_h_, 0) &lt;&lt; &quot;Input dimensions cannot be zero.&quot;;</span>
<span class="lineNum">      75 </span><span class="lineNoCov">          0 :   CHECK_GT(bottom_w_, 0) &lt;&lt; &quot;Input dimensions cannot be zero.&quot;;</span>
<span class="lineNum">      76 </span>            : 
<span class="lineNum">      77 </span><span class="lineNoCov">          0 :   pyramid_height_ = spp_param.pyramid_height();</span>
<span class="lineNum">      78 </span>            :   split_top_vec_.clear();
<span class="lineNum">      79 </span>            :   pooling_bottom_vecs_.clear();
<span class="lineNum">      80 </span><span class="lineNoCov">          0 :   pooling_layers_.clear();</span>
<span class="lineNum">      81 </span>            :   pooling_top_vecs_.clear();
<span class="lineNum">      82 </span>            :   pooling_outputs_.clear();
<span class="lineNum">      83 </span>            :   flatten_layers_.clear();
<span class="lineNum">      84 </span>            :   flatten_top_vecs_.clear();
<span class="lineNum">      85 </span>            :   flatten_outputs_.clear();
<span class="lineNum">      86 </span>            :   concat_bottom_vec_.clear();
<span class="lineNum">      87 </span>            : 
<span class="lineNum">      88 </span><span class="lineNoCov">          0 :   if (pyramid_height_ == 1) {</span>
<span class="lineNum">      89 </span>            :     // pooling layer setup
<span class="lineNum">      90 </span><span class="lineNoCov">          0 :     LayerParameter pooling_param = GetPoolingParam(0, bottom_h_, bottom_w_,</span>
<span class="lineNum">      91 </span><span class="lineNoCov">          0 :         spp_param);</span>
<span class="lineNum">      92 </span><span class="lineNoCov">          0 :     pooling_layers_.push_back(shared_ptr&lt;PoolingLayer&lt;Dtype&gt; &gt; (</span>
<span class="lineNum">      93 </span>            :         new PoolingLayer&lt;Dtype&gt;(pooling_param)));
<span class="lineNum">      94 </span><span class="lineNoCov">          0 :     pooling_layers_[0]-&gt;SetUp(bottom, top);</span>
<span class="lineNum">      95 </span>            :     return;
<span class="lineNum">      96 </span>            :   }
<span class="lineNum">      97 </span>            :   // split layer output holders setup
<span class="lineNum">      98 </span><span class="lineNoCov">          0 :   for (int i = 0; i &lt; pyramid_height_; i++) {</span>
<span class="lineNum">      99 </span><span class="lineNoCov">          0 :     split_top_vec_.push_back(new Blob&lt;Dtype&gt;());</span>
<span class="lineNum">     100 </span>            :   }
<span class="lineNum">     101 </span>            : 
<span class="lineNum">     102 </span>            :   // split layer setup
<span class="lineNum">     103 </span><span class="lineNoCov">          0 :   LayerParameter split_param;</span>
<span class="lineNum">     104 </span><span class="lineNoCov">          0 :   split_layer_.reset(new SplitLayer&lt;Dtype&gt;(split_param));</span>
<span class="lineNum">     105 </span><span class="lineNoCov">          0 :   split_layer_-&gt;SetUp(bottom, split_top_vec_);</span>
<span class="lineNum">     106 </span>            : 
<span class="lineNum">     107 </span><span class="lineNoCov">          0 :   for (int i = 0; i &lt; pyramid_height_; i++) {</span>
<span class="lineNum">     108 </span>            :     // pooling layer input holders setup
<span class="lineNum">     109 </span><span class="lineNoCov">          0 :     pooling_bottom_vecs_.push_back(new vector&lt;Blob&lt;Dtype&gt;*&gt;);</span>
<span class="lineNum">     110 </span><span class="lineNoCov">          0 :     pooling_bottom_vecs_[i]-&gt;push_back(split_top_vec_[i]);</span>
<span class="lineNum">     111 </span>            : 
<span class="lineNum">     112 </span>            :     // pooling layer output holders setup
<span class="lineNum">     113 </span><span class="lineNoCov">          0 :     pooling_outputs_.push_back(new Blob&lt;Dtype&gt;());</span>
<span class="lineNum">     114 </span><span class="lineNoCov">          0 :     pooling_top_vecs_.push_back(new vector&lt;Blob&lt;Dtype&gt;*&gt;);</span>
<span class="lineNum">     115 </span><span class="lineNoCov">          0 :     pooling_top_vecs_[i]-&gt;push_back(pooling_outputs_[i]);</span>
<span class="lineNum">     116 </span>            : 
<span class="lineNum">     117 </span>            :     // pooling layer setup
<span class="lineNum">     118 </span><span class="lineNoCov">          0 :     LayerParameter pooling_param = GetPoolingParam(</span>
<span class="lineNum">     119 </span><span class="lineNoCov">          0 :         i, bottom_h_, bottom_w_, spp_param);</span>
<span class="lineNum">     120 </span>            : 
<span class="lineNum">     121 </span><span class="lineNoCov">          0 :     pooling_layers_.push_back(shared_ptr&lt;PoolingLayer&lt;Dtype&gt; &gt; (</span>
<span class="lineNum">     122 </span>            :         new PoolingLayer&lt;Dtype&gt;(pooling_param)));
<span class="lineNum">     123 </span><span class="lineNoCov">          0 :     pooling_layers_[i]-&gt;SetUp(*pooling_bottom_vecs_[i], *pooling_top_vecs_[i]);</span>
<span class="lineNum">     124 </span>            : 
<span class="lineNum">     125 </span>            :     // flatten layer output holders setup
<span class="lineNum">     126 </span><span class="lineNoCov">          0 :     flatten_outputs_.push_back(new Blob&lt;Dtype&gt;());</span>
<span class="lineNum">     127 </span><span class="lineNoCov">          0 :     flatten_top_vecs_.push_back(new vector&lt;Blob&lt;Dtype&gt;*&gt;);</span>
<span class="lineNum">     128 </span><span class="lineNoCov">          0 :     flatten_top_vecs_[i]-&gt;push_back(flatten_outputs_[i]);</span>
<span class="lineNum">     129 </span>            : 
<span class="lineNum">     130 </span>            :     // flatten layer setup
<span class="lineNum">     131 </span><span class="lineNoCov">          0 :     LayerParameter flatten_param;</span>
<span class="lineNum">     132 </span><span class="lineNoCov">          0 :     flatten_layers_.push_back(new FlattenLayer&lt;Dtype&gt;(flatten_param));</span>
<span class="lineNum">     133 </span><span class="lineNoCov">          0 :     flatten_layers_[i]-&gt;SetUp(*pooling_top_vecs_[i], *flatten_top_vecs_[i]);</span>
<span class="lineNum">     134 </span>            : 
<span class="lineNum">     135 </span>            :     // concat layer input holders setup
<span class="lineNum">     136 </span><span class="lineNoCov">          0 :     concat_bottom_vec_.push_back(flatten_outputs_[i]);</span>
<span class="lineNum">     137 </span>            :   }
<span class="lineNum">     138 </span>            : 
<span class="lineNum">     139 </span>            :   // concat layer setup
<span class="lineNum">     140 </span><span class="lineNoCov">          0 :   LayerParameter concat_param;</span>
<span class="lineNum">     141 </span><span class="lineNoCov">          0 :   concat_layer_.reset(new ConcatLayer&lt;Dtype&gt;(concat_param));</span>
<span class="lineNum">     142 </span><span class="lineNoCov">          0 :   concat_layer_-&gt;SetUp(concat_bottom_vec_, top);</span>
<span class="lineNum">     143 </span>            : }
<span class="lineNum">     144 </span>            : 
<span class="lineNum">     145 </span>            : template &lt;typename Dtype&gt;
<span class="lineNum">     146 </span><span class="lineNoCov">          0 : void SPPLayer&lt;Dtype&gt;::Reshape(const vector&lt;Blob&lt;Dtype&gt;*&gt;&amp; bottom,</span>
<span class="lineNum">     147 </span>            :       const vector&lt;Blob&lt;Dtype&gt;*&gt;&amp; top) {
<span class="lineNum">     148 </span><span class="lineNoCov">          0 :   CHECK_EQ(4, bottom[0]-&gt;num_axes()) &lt;&lt; &quot;Input must have 4 axes, &quot;</span>
<span class="lineNum">     149 </span>            :       &lt;&lt; &quot;corresponding to (num, channels, height, width)&quot;;
<span class="lineNum">     150 </span>            :   // Do nothing if bottom shape is unchanged since last Reshape
<span class="lineNum">     151 </span><span class="lineNoCov">          0 :   if (num_ == bottom[0]-&gt;num() &amp;&amp; channels_ == bottom[0]-&gt;channels() &amp;&amp;</span>
<span class="lineNum">     152 </span><span class="lineNoCov">          0 :       bottom_h_ == bottom[0]-&gt;height() &amp;&amp; bottom_w_ == bottom[0]-&gt;width() &amp;&amp;</span>
<span class="lineNum">     153 </span>            :       reshaped_first_time_) {
<span class="lineNum">     154 </span><span class="lineNoCov">          0 :     return;</span>
<span class="lineNum">     155 </span>            :   }
<span class="lineNum">     156 </span><span class="lineNoCov">          0 :   num_ = bottom[0]-&gt;num();</span>
<span class="lineNum">     157 </span><span class="lineNoCov">          0 :   channels_ = bottom[0]-&gt;channels();</span>
<span class="lineNum">     158 </span><span class="lineNoCov">          0 :   bottom_h_ = bottom[0]-&gt;height();</span>
<span class="lineNum">     159 </span><span class="lineNoCov">          0 :   bottom_w_ = bottom[0]-&gt;width();</span>
<span class="lineNum">     160 </span><span class="lineNoCov">          0 :   reshaped_first_time_ = true;</span>
<span class="lineNum">     161 </span><span class="lineNoCov">          0 :   SPPParameter spp_param = this-&gt;layer_param_.spp_param();</span>
<span class="lineNum">     162 </span><span class="lineNoCov">          0 :   if (pyramid_height_ == 1) {</span>
<span class="lineNum">     163 </span><span class="lineNoCov">          0 :     LayerParameter pooling_param = GetPoolingParam(0, bottom_h_, bottom_w_,</span>
<span class="lineNum">     164 </span><span class="lineNoCov">          0 :         spp_param);</span>
<span class="lineNum">     165 </span><span class="lineNoCov">          0 :     pooling_layers_[0].reset(new PoolingLayer&lt;Dtype&gt;(pooling_param));</span>
<span class="lineNum">     166 </span><span class="lineNoCov">          0 :     pooling_layers_[0]-&gt;SetUp(bottom, top);</span>
<span class="lineNum">     167 </span><span class="lineNoCov">          0 :     pooling_layers_[0]-&gt;Reshape(bottom, top);</span>
<span class="lineNum">     168 </span>            :     return;
<span class="lineNum">     169 </span>            :   }
<span class="lineNum">     170 </span><span class="lineNoCov">          0 :   split_layer_-&gt;Reshape(bottom, split_top_vec_);</span>
<span class="lineNum">     171 </span><span class="lineNoCov">          0 :   for (int i = 0; i &lt; pyramid_height_; i++) {</span>
<span class="lineNum">     172 </span><span class="lineNoCov">          0 :     LayerParameter pooling_param = GetPoolingParam(</span>
<span class="lineNum">     173 </span><span class="lineNoCov">          0 :         i, bottom_h_, bottom_w_, spp_param);</span>
<span class="lineNum">     174 </span>            : 
<span class="lineNum">     175 </span><span class="lineNoCov">          0 :     pooling_layers_[i].reset(</span>
<span class="lineNum">     176 </span>            :         new PoolingLayer&lt;Dtype&gt;(pooling_param));
<span class="lineNum">     177 </span><span class="lineNoCov">          0 :     pooling_layers_[i]-&gt;SetUp(</span>
<span class="lineNum">     178 </span>            :         *pooling_bottom_vecs_[i], *pooling_top_vecs_[i]);
<span class="lineNum">     179 </span><span class="lineNoCov">          0 :     pooling_layers_[i]-&gt;Reshape(</span>
<span class="lineNum">     180 </span>            :         *pooling_bottom_vecs_[i], *pooling_top_vecs_[i]);
<span class="lineNum">     181 </span><span class="lineNoCov">          0 :     flatten_layers_[i]-&gt;Reshape(</span>
<span class="lineNum">     182 </span>            :         *pooling_top_vecs_[i], *flatten_top_vecs_[i]);
<span class="lineNum">     183 </span>            :   }
<span class="lineNum">     184 </span><span class="lineNoCov">          0 :   concat_layer_-&gt;Reshape(concat_bottom_vec_, top);</span>
<span class="lineNum">     185 </span>            : }
<span class="lineNum">     186 </span>            : 
<span class="lineNum">     187 </span>            : template &lt;typename Dtype&gt;
<span class="lineNum">     188 </span><span class="lineNoCov">          0 : void SPPLayer&lt;Dtype&gt;::Forward_cpu(const vector&lt;Blob&lt;Dtype&gt;*&gt;&amp; bottom,</span>
<span class="lineNum">     189 </span>            :       const vector&lt;Blob&lt;Dtype&gt;*&gt;&amp; top) {
<span class="lineNum">     190 </span><span class="lineNoCov">          0 :   if (pyramid_height_ == 1) {</span>
<span class="lineNum">     191 </span><span class="lineNoCov">          0 :     pooling_layers_[0]-&gt;Forward(bottom, top);</span>
<span class="lineNum">     192 </span><span class="lineNoCov">          0 :     return;</span>
<span class="lineNum">     193 </span>            :   }
<span class="lineNum">     194 </span><span class="lineNoCov">          0 :   split_layer_-&gt;Forward(bottom, split_top_vec_);</span>
<span class="lineNum">     195 </span><span class="lineNoCov">          0 :   for (int i = 0; i &lt; pyramid_height_; i++) {</span>
<span class="lineNum">     196 </span><span class="lineNoCov">          0 :     pooling_layers_[i]-&gt;Forward(</span>
<span class="lineNum">     197 </span><span class="lineNoCov">          0 :         *pooling_bottom_vecs_[i], *pooling_top_vecs_[i]);</span>
<span class="lineNum">     198 </span><span class="lineNoCov">          0 :     flatten_layers_[i]-&gt;Forward(</span>
<span class="lineNum">     199 </span>            :         *pooling_top_vecs_[i], *flatten_top_vecs_[i]);
<span class="lineNum">     200 </span>            :   }
<span class="lineNum">     201 </span><span class="lineNoCov">          0 :   concat_layer_-&gt;Forward(concat_bottom_vec_, top);</span>
<span class="lineNum">     202 </span>            : }
<span class="lineNum">     203 </span>            : 
<span class="lineNum">     204 </span>            : template &lt;typename Dtype&gt;
<span class="lineNum">     205 </span><span class="lineNoCov">          0 : void SPPLayer&lt;Dtype&gt;::Backward_cpu(const vector&lt;Blob&lt;Dtype&gt;*&gt;&amp; top,</span>
<span class="lineNum">     206 </span>            :       const vector&lt;bool&gt;&amp; propagate_down, const vector&lt;Blob&lt;Dtype&gt;*&gt;&amp; bottom) {
<span class="lineNum">     207 </span><span class="lineNoCov">          0 :   if (!propagate_down[0]) {</span>
<span class="lineNum">     208 </span><span class="lineNoCov">          0 :     return;</span>
<span class="lineNum">     209 </span>            :   }
<span class="lineNum">     210 </span><span class="lineNoCov">          0 :   if (pyramid_height_ == 1) {</span>
<span class="lineNum">     211 </span><span class="lineNoCov">          0 :     pooling_layers_[0]-&gt;Backward(top, propagate_down, bottom);</span>
<span class="lineNum">     212 </span>            :     return;
<span class="lineNum">     213 </span>            :   }
<span class="lineNum">     214 </span><span class="lineNoCov">          0 :   vector&lt;bool&gt; concat_propagate_down(pyramid_height_, true);</span>
<span class="lineNum">     215 </span><span class="lineNoCov">          0 :   concat_layer_-&gt;Backward(top, concat_propagate_down, concat_bottom_vec_);</span>
<span class="lineNum">     216 </span><span class="lineNoCov">          0 :   for (int i = 0; i &lt; pyramid_height_; i++) {</span>
<span class="lineNum">     217 </span><span class="lineNoCov">          0 :     flatten_layers_[i]-&gt;Backward(</span>
<span class="lineNum">     218 </span><span class="lineNoCov">          0 :         *flatten_top_vecs_[i], propagate_down, *pooling_top_vecs_[i]);</span>
<span class="lineNum">     219 </span><span class="lineNoCov">          0 :     pooling_layers_[i]-&gt;Backward(</span>
<span class="lineNum">     220 </span>            :         *pooling_top_vecs_[i], propagate_down, *pooling_bottom_vecs_[i]);
<span class="lineNum">     221 </span>            :   }
<span class="lineNum">     222 </span><span class="lineNoCov">          0 :   split_layer_-&gt;Backward(split_top_vec_, propagate_down, bottom);</span>
<span class="lineNum">     223 </span>            : }
<a name="224"><span class="lineNum">     224 </span>            : </a>
<span class="lineNum">     225 </span>            : INSTANTIATE_CLASS(SPPLayer);
<a name="226"><span class="lineNum">     226 </span><span class="lineCov">          3 : REGISTER_LAYER_CLASS(SPP);</span></a>
<span class="lineNum">     227 </span>            : 
<span class="lineNum">     228 </span><span class="lineCov">          3 : }  // namespace caffe</span>
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="ruler"><img src="../../../glass.png" width=3 height=3 alt=""></td></tr>
    <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.12</a></td></tr>
  </table>
  <br>

</body>
</html>
